package main

import (
	"fmt"
	"math/rand"
	"strconv"
	"time"
)

func isRightNum(keys string) (int, bool) {
	key, errKeys := strconv.Atoi(keys)
	if errKeys != nil {
		return 0, false
	} else {
		return key, true
	}
}
func main() {
	var count int = 1
	rand.Seed(time.Now().UnixNano())
	num := rand.Intn(100) + 1
	var key string
	fmt.Println("随机数：", num)
	for {
		// 猜数开始
		fmt.Scanln(&key)
		keyInt, isNum := isRightNum(key)
		if isNum && (keyInt == num) {
			if count == 1 {
				fmt.Println("你真是个天才")
				break
			} else if count >= 2 && count <= 3 {
				fmt.Println("你很聪明赶上我了")
				break
			} else if count >= 4 && count <= 9 {
				fmt.Println("一般般")
				break
			} else if count == 10 {
				fmt.Println("可算猜对了")
				break
			} else {
				fmt.Println("说你点啥好")
				break
			}
		} else {
			count++
			if count > 10 {
				fmt.Println("说你点啥好")
				break
			}
		}

	}
	fmt.Println(count)
}
